package banking;

import money.Money;

public class DepositAccount extends Account {

	// ---------------------------------
	// Attributes
	// ---------------------------------

	private static int INTEREST_VALUE;
	private static int RUNTIME;
	private static int MONTH_COUNTER = 1;
	private static long TIMESTAMP;

	// ---------------------------------
	// Constructors
	// ---------------------------------

	protected DepositAccount(int accountNumber ,String accountHolder,
			String typ, String language, String country) {
		super(accountNumber, accountHolder, typ, language, country);
	}

	// ---------------------------------
	// Methods
	// ---------------------------------

	@Override
	public void plus(Money addMoney) {
		setBalance(getBalance().getValue() + addMoney.getValue());
	}

	@Override
	public void minus(Money removeMoney) {
		setBalance(getBalance().getValue() - removeMoney.getValue());
	}

	@Override
	public void interest() {
		if (RUNTIME == MONTH_COUNTER) {
			setBalance((long) (getBalance().getValue() * (1 + (double) INTEREST_VALUE / 100)));
			// System.out.println("yea");
			// System.out.println(BankImpl.getAccount()[i_counter].showOutput());
			System.out.println(showOutput());
			MONTH_COUNTER = 1;
		}

		else {
			++MONTH_COUNTER;
		}
	}

	// ---------------------------------
	// Getter / Setter
	// ---------------------------------

	public static long getInterestValue() {
		return INTEREST_VALUE;
	}

	@Override
	public void setInterestValue(int changeInterest) {
		INTEREST_VALUE = changeInterest;
	}

	@Override
	public void setRuntimeValue(int length) {
		RUNTIME = length;
	}

	@Override
	public void setTimestamp(long timestamp) {
		TIMESTAMP = timestamp;
	}

	@Override
	public long getTimestamp() {
		return TIMESTAMP;
	}

}
